
import 'package:flutter/material.dart';
import 'package:get/get.dart';
import 'package:zfth/api/AlarmApi.dart';

import '../../components/form/LFormLogic.dart';
import '../../components/form/LFormPage.dart';
import '../../components/list/LCellListLogic.dart';
import '../../utils/Settings.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';

import '../../utils/StoreData.dart';



class SmokeAlarmLogDetailPage extends StatefulWidget{

  const SmokeAlarmLogDetailPage({super.key});

  @override
  State<SmokeAlarmLogDetailPage> createState() =>SmokeAlarmLogDetailState();

}

class SmokeAlarmLogDetailState extends State<SmokeAlarmLogDetailPage> with AutomaticKeepAliveClientMixin{

  String formTag = "SmokeAlarmLogDetail";
  late final LFormLogic lFormLogic;
  bool keepAlive = true;
  List formItems = [
    {"field":'deviceRegion',"label":'区域',"component":'select',"readonly":true,"required":false,"isShowLabel":true,"dictCode":Settings.dictCodes["区域"]},
    {"field":'deviceRoom',"label":'电房',"component":'select',"readonly":true,"required":false,"isShowLabel":true,"dictCode":Settings.dictCodes["配电室"]},
    {"field":'deviceNo',"label":'终端编码',"component":'input',"readonly":true,"required":false,"isShowLabel":true},
    {"field":'deviceName',"label":'终端名称',"component":'input',"readonly":true,"required":false,"isShowLabel":true},
    {"field":'createTime',"label":'报警时间',"component":'datetime',"readonly":true,"required":false,"isShowLabel":true},
    {"field":'actionType',"label":'处理类型',"component":'select',"readonly":true,"required":false,"isShowLabel":true,"dictCode":Settings.dictCodes["报警处理类型"]},
    {"field":'actionResult',"label":'处理结果',"component":'input',"readonly":true,"required":false,"isShowLabel":true},
    {"field":'actionTime',"label":'处理时间',"component":'input',"readonly":true,"required":false,"isShowLabel":true},
    {"field":'actionEmpName',"label":'处理人',"component":'input',"readonly":true,"required":false,"isShowLabel":true},

  ];
  Map formData={};
  late String returnTag;


  @override
  void initState() {
    //获取页面传入的参数
    formData=Get.arguments["item"];


    returnTag = Get.arguments["tag"];

    lFormLogic = Get.put(LFormLogic(),tag:formTag);
    lFormLogic.init(formItems: formItems, formData: formData,tag: formTag,onChangeCallback: onChange);

    super.initState();
  }





  @override
  void dispose() {
    Get.delete<LFormLogic>(tag: formTag);
    super.dispose();
  }

  @override
  bool get wantKeepAlive => keepAlive;
  bool isShowButton = true;

  ///内容改变后的回调
  void onChange(re){}



  @override
  Widget build(BuildContext context) {
    super.build(context);
    return Scaffold(
      backgroundColor: Settings.backgroundColor,
      appBar: AppBar(
        title: const Text("烟感报警详情"),
        centerTitle: true,
        elevation: 0,
      ),
      body: SingleChildScrollView(
        child: Stack(
          children: [
            Column(
              children: [
                LFormPage(tag:formTag),
              ],
            ),
          ],
        ),
      )




    );
  }


}